After using File::makeDirectory in Laravel, I get "mkdir(): No such file or directory" error
NickName:Onyx Ask DateTime:2018-02-22T01:35:51

After using File::makeDirectory in Laravel, I get "mkdir(): No such file or directory" error

I'm trying to create a folder that will contain all images of an image album. Unfortunately, when I try to use File::makeDirectory I get the "mkdir(): No such file or directory" error. Now, I am either using it incorrectly or there's something wrong with my path. My goal is to create a folder called $albumName in my albums folder. Also considering I'm using php artisan storage:link, should my path be:

public/albums/'.$albumName

or

public/storage/albums/'.$albumName

My code so far.

public function uploadAlbum(Request $request){

        $albumName = $request['albumName'];
        $albumPath = File::makeDirectory('public/albums/'.$albumName);


        return redirect()->route('home');
    }

the error

C:\MAMP\htdocs\LaravelProject\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php

        return $directories;
    }

    /**
     * Create a directory.
     *
     * @param  string  $path
     * @param  int     $mode
     * @param  bool    $recursive
     * @param  bool    $force
     * @return bool
     */
    public function makeDirectory($path, $mode = 0755, $recursive = false, $force = false)
    {
        if ($force) {
            return @mkdir($path, $mode, $recursive);
        }

        return mkdir($path, $mode, $recursive);
    }

    /**
     * Move a directory.
     *
     * @param  string  $from
     * @param  string  $to
     * @param  bool  $overwrite
     * @return bool
     */
    public function moveDirectory($from, $to, $overwrite = false)
    {
        if ($overwrite && $this->isDirectory($to)) {
            if (! $this->deleteDirectory($to)) {
                return false;
            }
        }

        return @rename($from, $to) === true;
    }
Arguments
"mkdir(): No such file or directory"

Copyright Notice:Content Author:「Onyx」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/48912160/after-using-filemakedirectory-in-laravel-i-get-mkdir-no-such-file-or-dire

More about “After using File::makeDirectory in Laravel, I get "mkdir(): No such file or directory" error” related questions

After using File::makeDirectory in Laravel, I get "mkdir(): No such file or directory" error

I'm trying to create a folder that will contain all images of an image album. Unfortunately, when I try to use File::makeDirectory I get the "mkdir(): No such file or directory" error. Now, I am ei...

Show Detail

Laravel 5 - File::makedirectory

I simple just can't get this to work in Laravel 5. and furthermore Laravel doesn't give me any errors to work with. I have build a small CMS system where users are allowed to create a gallery page....

Show Detail

Laravel 5.2 Storage::makeDirectory($dir) is not creating directory

I am getting confused with this logic. I am using Laravel 5.2 Storage::makeDirectory to create two paths, first (video/) is created correctly and the other (thumbnails/) don't. $user = 1; if(!File::

Show Detail

File makeDirectory

I can make a Folder Successfully when a user create his account based on his chosen username but I also want to instruct make sub folders for instance when you create an account with username &quot...

Show Detail

Laravel 5: mkdir/Filesystem::makeDirectory with permissions from config

I'm running into an issue this morning with FileSystem::makeDirectory which directly calls mkdir. I'm trying to create a directory recursively pulling the desired mode out of my config like so: $

Show Detail

Using Storage::makeDirectory() not creating a folder in laravel

I'm trying to save a folder to the storage folder, but it isn't creating the folder. What happens is that, I save the folder name in a form and what I want to happen is that if that folder doesn't ...

Show Detail

is this possible to create subdirectory in FTP using ftp.MakeDirectory?

I have to create this query to get some answer before i change my code.Pardon me if this question is doesn't make sense to you guys. Scenario 1: string path :ftp://1.1.1.1/mpg/test"; FtpWebRequest

Show Detail

Using Laravel's File::makeDirectory to create a folder in the public directory

I have the following code in my controller - I am trying to create a directory structure to save files into: use File; ... $path = public_path().'/shared/uploads/images/brands/400'; if (!File::e...

Show Detail

Laravel 5 global variable in views

I created a GlobalComposer class to get the username in all Views: <?php namespace App\Http\ViewComposers; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Auth; class

Show Detail

where can I change configurations on the fly after User autenticaton in laravel?

I am using elfinder laravel package to manage and organize files. It has a elfinder.dir config options that used to specifies a directory that user can upload files to it. Now I want to change (or

Show Detail